BEGIN DISTRIBUTED TRANSACTION;  -- 声明分布式事务‌:ml-citation{ref="2,7" data="citationList"}
BEGIN TRY
    -- 本地订单表更新
    UPDATE LocalDB.dbo.Orders SET Status = 'Shipped' WHERE OrderID = 1001;

    -- 远程物流系统操作（通过Linked Server）
    EXEC OracleLinkedServer..Logistics.UpdateShipmentStatus 
        @OrderID = 1001, 
        @Status = 'InTransit';

    COMMIT TRANSACTION;  -- 由MSDTC协调提交‌:ml-citation{ref="2,7" data="citationList"}
END TRY
BEGIN CATCH
    IF XACT_STATE() <> 0 
        ROLLBACK TRANSACTION;
    -- 记录跨系统错误
    INSERT INTO CrossSystemError (Details) VALUES (ERROR_MESSAGE());
END CATCH;
